/*
 * @Author: your name
 * @Date: 2021-04-12 00:21:10
 * @LastEditTime: 2021-11-30 10:51:36
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /fun_android/lib/service/app_repository.dart
 */
import 'package:flutter/cupertino.dart';
import 'package:full_flutter/config/net/pgyer_api.dart';

/// App相关接口
class AppRepository {
  static Future<AppUpdateInfo?> checkUpdate(
      String platform, String version) async {
    debugPrint('检查更新,当前版本为===>$version');
    var response = await http
        .post('app/check', queryParameters: {'buildVersion': version});
    var result = AppUpdateInfo.fromMap(response.data);
    if (result.buildHaveNewVersion) {
      debugPrint('发现新版本===>${result.buildVersion}');
      return result;
    }
    debugPrint('没有发现新版本');
    return null;
  }
}
